home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ainet / newmv.frm < prev    next >
Text File  |  1997-07-20  |  6KB  |  214 lines

  1. VERSION 4.00
  2. Begin VB.Form NewMV 
  3.    Caption         =   "New Model Vector ..."
  4.    ClientHeight    =   3492
  5.    ClientLeft      =   1560
  6.    ClientTop       =   2340
  7.    ClientWidth     =   4332
  8.    Height          =   3876
  9.    Left            =   1512
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3492
  12.    ScaleWidth      =   4332
  13.    Top             =   2004
  14.    Width           =   4428
  15.    Begin VB.CommandButton OkBtn 
  16.       Caption         =   "OK"
  17.       Default         =   -1  'True
  18.       Height          =   372
  19.       Left            =   3120
  20.       TabIndex        =   10
  21.       Top             =   840
  22.       Width           =   972
  23.    End
  24.    Begin VB.Frame Frame2 
  25.       Caption         =   "New Model Vector Data"
  26.       Height          =   852
  27.       Left            =   240
  28.       TabIndex        =   12
  29.       Top             =   1920
  30.       Width           =   3852
  31.       Begin VB.TextBox Hole 
  32.          Height          =   288
  33.          Left            =   3000
  34.          ReadOnly        =   -1  'True
  35.          TabIndex        =   14
  36.          Top             =   360
  37.          Width           =   612
  38.       End
  39.       Begin VB.TextBox YC 
  40.          Height          =   288
  41.          Left            =   1560
  42.          TabIndex        =   9
  43.          Top             =   360
  44.          Width           =   612
  45.       End
  46.       Begin VB.TextBox XC 
  47.          Height          =   288
  48.          Left            =   480
  49.          TabIndex        =   7
  50.          Top             =   360
  51.          Width           =   612
  52.       End
  53.       Begin VB.Label Label4 
  54.          Alignment       =   1  'Right Justify
  55.          Caption         =   "Is hole?"
  56.          Height          =   252
  57.          Left            =   2160
  58.          TabIndex        =   13
  59.          Top             =   360
  60.          Width           =   732
  61.       End
  62.       Begin VB.Label Label3 
  63.          Alignment       =   1  'Right Justify
  64.          Caption         =   "&Y:"
  65.          Height          =   252
  66.          Left            =   1200
  67.          TabIndex        =   8
  68.          Top             =   360
  69.          Width           =   252
  70.       End
  71.       Begin VB.Label Label1 
  72.          Alignment       =   1  'Right Justify
  73.          Caption         =   "&X:"
  74.          Height          =   252
  75.          Left            =   120
  76.          TabIndex        =   6
  77.          Top             =   360
  78.          Width           =   252
  79.       End
  80.    End
  81.    Begin VB.TextBox Index 
  82.       Height          =   288
  83.       Left            =   1680
  84.       TabIndex        =   5
  85.       Top             =   840
  86.       Width           =   732
  87.    End
  88.    Begin VB.CommandButton Cancel 
  89.       Cancel          =   -1  'True
  90.       Caption         =   "Cancel"
  91.       Height          =   372
  92.       Left            =   3120
  93.       TabIndex        =   3
  94.       Top             =   360
  95.       Width           =   972
  96.    End
  97.    Begin VB.OptionButton Append 
  98.       Caption         =   "&Append"
  99.       Height          =   252
  100.       Left            =   480
  101.       TabIndex        =   2
  102.       Top             =   1320
  103.       Width           =   1452
  104.    End
  105.    Begin VB.OptionButton Overwrite 
  106.       Caption         =   "&Overwrite"
  107.       Height          =   252
  108.       Left            =   480
  109.       TabIndex        =   1
  110.       Top             =   960
  111.       Width           =   1452
  112.    End
  113.    Begin VB.OptionButton Insert 
  114.       Caption         =   "&Insert"
  115.       Height          =   252
  116.       Left            =   480
  117.       TabIndex        =   0
  118.       Top             =   600
  119.       Width           =   972
  120.    End
  121.    Begin VB.Frame Frame1 
  122.       Caption         =   "Method of Insetion"
  123.       Height          =   1572
  124.       Left            =   240
  125.       TabIndex        =   11
  126.       Top             =   240
  127.       Width           =   2652
  128.       Begin VB.Label IndexLabel 
  129.          Alignment       =   2  'Center
  130.          Caption         =   "at i&ndex"
  131.          Height          =   252
  132.          Left            =   1320
  133.          TabIndex        =   4
  134.          Top             =   360
  135.          Width           =   732
  136.       End
  137.    End
  138.    Begin VB.Label Label5 
  139.       Caption         =   "Be careful when entering numbers. If entered string holds invalid characters, the program might crash!"
  140.       Height          =   492
  141.       Left            =   240
  142.       TabIndex        =   15
  143.       Top             =   2880
  144.       Width           =   3852
  145.    End
  146. End
  147. Attribute VB_Name = "NewMV"
  148. Attribute VB_Creatable = False
  149. Attribute VB_Exposed = False
  150. Private X As Single
  151. Private Y As Single
  152.  
  153. Private Function CalcHole() As Integer
  154.     X = CSng(XC)
  155.     If X < -1 Or X > 1 Then
  156.         MsgBox ("X must lie within [-1 ...1]!")
  157.         Hole = "Error"
  158.         CalcHole = 0
  159.     Else
  160.         Y = CSng(YC)
  161.         If Y < -1 Or Y > 1 Then
  162.             MsgBox ("The number must lie within [-1 ...1]!")
  163.             Hole = "Error"
  164.             CalcHole = 0
  165.         Else
  166.             r = Sqr(X * X + Y * Y)
  167.             If r > 0.7 Then
  168.                 Hole = "No (0)"
  169.             Else
  170.                 Hole = "Yes (1)"
  171.             End If
  172.             CalcHole = 1
  173.         End If
  174.     End If
  175. End Function
  176.  
  177. Private Sub Append_Click()
  178.     index.Enabled = False
  179.     indexLabel.Enabled = False
  180. End Sub
  181.  
  182. Private Sub Cancel_Click()
  183.     MainForm.Ret = 0
  184.     Hide
  185. End Sub
  186.  
  187. Private Sub Insert_Click()
  188.     index.Enabled = True
  189.     indexLabel.Enabled = True
  190. End Sub
  191.  
  192. Private Sub OKBtn_Click()
  193.     If CalcHole = 1 Then
  194.         'MainForm.Par2 = CLng(index)
  195.         MainForm.X = X
  196.         MainForm.Y = Y
  197.         MainForm.Ret = 1
  198.         Hide
  199.     End If
  200. End Sub
  201.  
  202. Private Sub Overwrite_Click()
  203.     Insert_Click
  204. End Sub
  205.  
  206. Private Sub XC_LostFocus()
  207.     CalcHole
  208. End Sub
  209.  
  210. Private Sub YC_LostFocus()
  211.     CalcHole
  212. End Sub
  213.  
  214.